package MainTest;

/**
 * Created by xuyi on 2017/2/12.
 */
public class BinaryString {


    public static void main(String[] args) {
        int i = -2;
        int count = 0;

        String binaryString = Integer.toBinaryString(i);
        for (int j = 0; j < binaryString.length(); j++) {
            char c = binaryString.charAt(j);
            if (c == '1') {
                count++;
            }
        }
    }



}
